home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / ISSUE23 / PZAZZDEM / PZAZZDEM.ZIP / PZDEMO / PZDLVIEW.PAS < prev    next >
Pascal/Delphi Source File  |  1997-02-18  |  3KB  |  117 lines

  1. unit Pzdlview;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, ExtCtrls, PZBPanel, PZShaded, StdCtrls, PZLabel, PZSpButt,
  8.   PZLView, Buttons;
  9.  
  10. type
  11.   TPZListViewForm = class(TForm)
  12.     HeaderPanel: TPZBitmapPanel;
  13.     PZShaded1: TPZShaded;
  14.     DescrPanel: TPZBitmapPanel;
  15.     PZLabel4: TPZLabel;
  16.     ResultsPanel: TPZBitmapPanel;
  17.     PZLabel2: TPZLabel;
  18.     PZLabel1: TPZLabel;
  19.     OutputPanel1: TPZBitmapPanel;
  20.     FishView: TPZListView;
  21.     OutputPanel2: TPZBitmapPanel;
  22.     BackgroundCheck: TCheckBox;
  23.     Label1: TLabel;
  24.     PZLabel3: TPZLabel;
  25.     PZLabel5: TPZLabel;
  26.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  27.     procedure FormCreate(Sender: TObject);
  28.     procedure FormDeactivate(Sender: TObject);
  29.     procedure Label1Click(Sender: TObject);
  30.     procedure BackgroundCheckClick(Sender: TObject);
  31.     function FishViewCompareItems(Index1, Index2,
  32.       Column: Integer): Integer;
  33.   private
  34.     { Private declarations }
  35.   public
  36.     { Public declarations }
  37.   end;
  38.  
  39. var
  40.   PZListViewForm: TPZListViewForm;
  41.  
  42. implementation
  43.  
  44. Uses PZDMain;
  45.  
  46. {$R *.DFM}
  47.  
  48. procedure TPZListViewForm.FormCreate(Sender: TObject);
  49.  
  50. Begin
  51.   SetBounds(10,10,MainForm.ClientWidth-20,MainForm.ClientHeight-MainForm.MainPanel.Height-20);
  52.   HeaderPanel.Background.LoadBitmap('PZD_STONE');
  53.   DescrPanel.Background.LoadBitmap('PZD_STONE');
  54.   ResultsPanel.Background.LoadBitmap('PZD_STONE');
  55.   OutputPanel1.Background.LoadBitmap('PZD_STONE');
  56.   OutputPanel2.Background.LoadBitmap('PZD_STONE');
  57. End;
  58.  
  59. procedure TPZListViewForm.FormClose(Sender: TObject;  var Action: TCloseAction);
  60.  
  61. Begin
  62.   Action:=caFree;
  63. End;
  64.  
  65. procedure TPZListViewForm.FormDeactivate(Sender: TObject);
  66. begin
  67.   Close;
  68. end;
  69.  
  70. procedure TPZListViewForm.Label1Click(Sender: TObject);
  71. begin
  72.   If BackgroundCheck.State=cbChecked Then
  73.     BackgroundCheck.State:=cbUnchecked
  74.   Else
  75.     BackgroundCheck.State:=cbChecked;
  76.   BackgroundCheck.SetFocus;
  77. end;
  78.  
  79. procedure TPZListViewForm.BackgroundCheckClick(Sender: TObject);
  80. begin
  81.   If BackgroundCheck.State=cbChecked Then
  82.     FishView.Background.LoadBitmap('PZD_FISH')
  83.   Else
  84.     FishView.Background.Bitmap.Assign(Nil);
  85. end;
  86.  
  87. function TPZListViewForm.FishViewCompareItems(Index1, Index2,
  88.   Column: Integer): Integer;
  89.  
  90. Var
  91.   Item1,Item2 :String;
  92.   l1,l2       :Double;
  93.  
  94. begin
  95.   Result:=0;
  96.   Item1:=ItemToItemPart(FishView.Items[Index1],Column);
  97.   Item2:=ItemToItemPart(FishView.Items[Index2],Column);
  98.   If Column<4 Then
  99.     Begin
  100.       If Item1<Item2 Then
  101.         Result:=-1
  102.       Else If Item1>Item2 Then
  103.         Result:=1;
  104.     End
  105.   Else
  106.     Begin
  107.       l1:=StrToFloat(Item1);
  108.       l2:=StrToFloat(Item2);
  109.       If l1<l2 Then
  110.         Result:=-1
  111.       Else If l1>l2 Then
  112.         Result:=1;
  113.     End;
  114. end;
  115.  
  116. end.
  117.